package jbase.project.system.net.http;

import java.util.Map;

import jbase.project.system.core.common.EventHook;

public class HttpEventHandleHook implements EventHook {

	private IHttpHandle handle;

	public HttpEventHandleHook(IHttpHandle handle) {
		this.handle = handle;
	}

	@SuppressWarnings("unchecked")
	@Override
	public <T, R> R event(String event, T... objects) {
		if (event.equals(HttpConstants.HTTP_REQUEST_DELEGATE_EVENT_GET)) {
			this.handle.handleRequest((Map<String, Object>) objects[0]);
		} else if (event.equals(HttpConstants.HTTP_REQUEST_DELEGATE_EVENT_POST)) {
			this.handle.handleRequest((Map<String, Object>) objects[0]);
		}
		return (R) (Object) true;
	}
}